<?php
require_once 'factory/IMFactory.php';
require_once 'Zend/Loader.php';

class MFactory implements IMFactory{

	public static function instance(AMClassDefinition $CD){
		try {
			Zend_Loader::loadClass($CD->name, $CD->path);
			//Zend_Loader::loadFile($class['name'].'.php', $path, $require_once);
		} catch (Zend_Exception $ze){
			echo $ze->getMessage();
			//exit;
		}
		//get the class properties
		$class_ = new ReflectionClass($CD->name);
		
		if($CD->args)
			return $class_->newInstanceArgs($CD->args);
		else
			return $class_->newInstance();
	}
}
?>